Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorate ImpossibleCheckTypeHelper with reason #3579

Draft
wants to merge 3 commits into
base: 1.12.x
Choose a base branch
from

Conversation

VincentLanglet
Copy link
Contributor

$addTip = function (RuleErrorBuilder $ruleErrorBuilder) use ($scope, $node): RuleErrorBuilder {
$addTip = function (RuleErrorBuilder $ruleErrorBuilder) use ($scope, $node, $reasons): RuleErrorBuilder {
if (count($reasons) > 0) {
return $ruleErrorBuilder->acceptsReasonsTip($reasons);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied 6ac62d3...dc5d8f4#diff-6f5d047ab5b60f37c6dca68882f80e1f7ba2d946e0ffb91290d39589cf55acc2R58-R60

but looking at the failing test, I feel like we want to keep the treatPhpDocTypesAsCertainTip @ondrejmirtes , no ?
(So maybe the StrictComparisonOfDifferentTypesRule too ?)

Currently I dunno if I need to

  • Update the tests.
  • Or update this line of code.

Your call.

Comment on lines +1113 to +1115
"• 'publishDate' is not lowercase.
• 'approvedAt' is not lowercase.
• 'allowedValues' is not lowercase.",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the comparison is between 'publishDate'|'approvedAt'|'allowedValues' and lowercase string, and because of how UnionType::isSuperTypeOfWithReason works

$result = IsSuperTypeOfResult::createNo()->or(...array_map(static fn (Type $innerType) => $innerType->isSuperTypeOfWithReason($otherType), $this->types));
		if ($result->yes()) {
			return $result;
		}

we have a list with three reasons.

Is it ok for you @ondrejmirtes ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant